package com.onpositive.wiki3.db.impl;

import java.io.File;

import com.onpositive.wiki3.db.catmodel.Categories;
import com.onpositive.wiki3.db.catmodel.matches.classify.RelationStore;

public class Test8 {

	public static void main(String[] args) {
		if (true){
			LeafsReadder.main(args);
			return;
		}
		final WikiDBImpl wikiDBImpl = new WikiDBImpl("C:/work/content");
		try {
			RelationStore ss = new RelationStore(wikiDBImpl);
			System.setProperty("wordnet.database.dir", "C:/work/wn/dict");

			final Categories c0 = new Categories(wikiDBImpl, new File(
					"C:/work/content/n2.cats"), false);
			final CategoryTemplateStore cm = new CategoryTemplateStore();
			cm.read(wikiDBImpl.getPath() + "/cattemplates.obj");
			// Category category = c0.get("aircraft_manufacturers");
			// CatTemplateInfo catTemplateInfo = cm.get(category, 0);
			// System.out.println(catTemplateInfo.primaryTemplate);
//			c0.accept(new AbstractRecordingMatcher(ss) {
//
//				@Override
//				public int accept(Category st) {
//					Category[] parentsCategories = st.getParentsCategories();
//					CatTemplateInfo catTemplateInfo = cm.get(st, 0);
//					if (catTemplateInfo != null) {
//						for (Category q : parentsCategories) {
//							CatTemplateInfo m0 = cm.get(q, 0);
//							if (m0 != null
//									&& catTemplateInfo.primaryTemplate
//											.equals(m0.primaryTemplate)) {
//								record(RelationConstants.IS_A, q, st);
//							}
//						}
//					}
//					// TODO Auto-generated method stub
//					return 0;
//				}
//			});
//			c0.accept(new MultiParentMatcher(ss));
			ss.save();
			// c0.removeAllContaining(wikiDBImpl, "articles");
			// c0.removeAllContaining(wikiDBImpl, "wikipedia");
			// c0.removeAllContaining(wikiDBImpl, "categories_by");
			// c0.removeAllContaining(wikiDBImpl, "portal");
			// c0.removeCategory(c0.get("container_categories").id());
			// c0.removeCategory(c0.get("hidden_categories").id());
			// c0.removeCategory(c0.get("categories").id());

		} catch (Exception e) {
			e.printStackTrace();
			// TODO: handle exception
		}
	}
}
